import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttentionGroupVO, AttentionGroupForm, AttentionGroupQuery } from '@/api/stock/attentionGroup/types';

/**
 * 查询自选股分组列表
 * @param query
 * @returns {*}
 */

export const listAttentionGroup = (query?: AttentionGroupQuery): AxiosPromise<AttentionGroupVO[]> => {
  return request({
    url: '/stock/attentionGroup/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询自选股分组详细
 * @param id
 */
export const getAttentionGroup = (id: string | number): AxiosPromise<AttentionGroupVO> => {
  return request({
    url: '/stock/attentionGroup/' + id,
    method: 'get'
  });
};

/**
 * 新增自选股分组
 * @param data
 */
export const addAttentionGroup = (data: AttentionGroupForm) => {
  return request({
    url: '/stock/attentionGroup',
    method: 'post',
    data: data
  });
};

/**
 * 修改自选股分组
 * @param data
 */
export const updateAttentionGroup = (data: AttentionGroupForm) => {
  return request({
    url: '/stock/attentionGroup',
    method: 'put',
    data: data
  });
};

/**
 * 删除自选股分组
 * @param id
 */
export const delAttentionGroup = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stock/attentionGroup/' + id,
    method: 'delete'
  });
};
